import { RouterModule, Routes } from '@angular/router';
import { IndexComponent } from './index/index.component';
import { LayoutComponent } from './layout/layout.component';
import { ArtileDetailsComponent } from './artile-details/artile-details.component';

const routes: Routes = [
    // 前台页面
    {
        path: 'about', component: LayoutComponent,
        children: [
            {
                path: '', pathMatch: 'full', redirectTo: 'index'
            },
            {
                path: 'index',
                component: IndexComponent
            },
            {
                path: 'artile-details',
                component: ArtileDetailsComponent
            }
        ]
    },
    // 后台页面
    {
        path: 'back',
        loadChildren: './back/back.module#BackModule'
    },
    // 重定向
    {path: '**', pathMatch: 'full', redirectTo: 'about'},

];

// 将路由配置导出为 appRouting 以供调用, 子模块中的路由使用 forChild 而不是 forRoot
export const appRouting = RouterModule.forRoot(routes);
